package sg.edu.nus.iss.vmcs;

/*
 * Copyright 2011 ISS.
 * The contents contained in this document may not be reproduced in any
 * form or by any means, without the written permission of ISS, other
 * than for the purpose for which it has been supplied.
 *
 */

import sg.edu.nus.iss.vmcs.system.*;
import sg.edu.nus.iss.vmcs.util.*;

/**
 * This class is starting point for the VMCS Application. It as the main
 * method which initiates the {@link MainController} class to initialize 
 * the other related objects of the VMCS and starts the {@link SimulatorControlPanel}.
 * It initializes the CashStore and DrinkStore data from the properties for
 * cash and drinks brand
 *
 * @version 1.0  07/12/2011
 * @author Team 7S - SE19
 */

public class Vmcs {

	private String propertiesFile;

/**
 * This operation sets the properties file
 * @param propertiesFile name of the properties file
 */	
	private Vmcs(String propertiesFile) {
		this.propertiesFile = propertiesFile;
	}

/**
 * This operation instantiates the MainController class and pass
 * the properties file 
 * @see MainController
 */
	public void start() {
		MainController mc = new MainController(propertiesFile);
		try {
			mc.start();
		} catch (VMCSException e) {
			System.out.println(
				"Vmcs.start: Error in system initialization: "
					+ e.getMessage());
			System.exit(0);
		}
	}

/**
 * This is the main method which initiates the application.
 * The starting point of the VCMS application which invokes the start() operation.
 */	
	public static void main(String args[]) {
		Vmcs vmcs = new Vmcs("vmcs.properties");
		vmcs.start();
	}
}
